﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using SilverChart.Core.Configuration;
using System.Collections.Generic;

namespace SilverChart.UnitTest.Core.Configuration {
    public class MockedConfigurationItemForValueItemHelper : AbstractConfigurationItem{
        public const String ITEM_NAME_INT32 = "int32";
        public const Int32 ITEM_VALUE_INT32 = 32;
        public const String ITEM_NAME_INT32_DEFAULT = "int32_default";

        public const String ITEM_NAME_BRUSH = "brush";
        public readonly static Brush ITEM_VALUE_BRUSH = new SolidColorBrush(Colors.Red);
        public const String ITEM_NAME_BRUSH_DEFAULT = "brush_default";

        public const String ITEM_NAME_ARRAY_ITEMS = "items";
        public readonly static ConfigurationItem ITEM_VALUE_ARRAY_ITEMS = new MockedConfigurationItemForValueItemHelper();
        public const String ITEM_NAME_ARRAY_ELEMENT = "item";
        public const String ITEM_NAME_ARRAY_ITEMS_DEFAULT = "items-defalut";
        public const String ITEM_NAME_ARRAY_ELEMENT_DEFAULT = "item-default";

        public MockedConfigurationItemForValueItemHelper() : base(null){
        }

        public override Boolean TryGetConfigurationValue<T>(string itemName, out T value) {
            if (itemName == ITEM_NAME_INT32) {
                value = (T)(Object)ITEM_VALUE_INT32;
                return true;
            }
            else if (itemName == ITEM_NAME_BRUSH) {
                value = (T)(Object)ITEM_VALUE_BRUSH;
                return true;
            }
            else if (itemName == ITEM_NAME_ARRAY_ITEMS) {
                value = (T)(Object)ITEM_VALUE_ARRAY_ITEMS;
                return true;
            }

            value = default(T);
            return false;
        }

        public override Boolean TryGetConfigurationValues<T>(string itemName, out System.Collections.Generic.IList<T> values) {
            if (itemName == ITEM_NAME_ARRAY_ELEMENT) {
                values = new List<T>();
                for (int i = 0; i < 3; i++) {
                    values.Add((T)(Object)i);
                }
                return true;
            }
            values = null;
            return false;
        }
    }
}
